Optimal. Leaf size=44 \[ \sqrt {a+b} \tanh ^{-1}\left (\frac {\sqrt {a+b \tanh ^2(x)}}{\sqrt {a+b}}\right )-\sqrt {a+b \tanh ^2(x)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 44, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3751, 455, 52,
65, 214} \begin {gather*} \sqrt {a+b} \tanh ^{-1}\left (\frac {\sqrt {a+b \tanh ^2(x)}}{\sqrt {a+b}}\right )-\sqrt {a+b \tanh ^2(x)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 52
Rule 65
Rule 214
Rule 455
Rule 3751
Rubi steps
\begin {align*} \int \tanh (x) \sqrt {a+b \tanh ^2(x)} \, dx &=\text {Subst}\left (\int \frac {x \sqrt {a+b x^2}}{1-x^2} \, dx,x,\tanh (x)\right )\\ &=\frac {1}{2} \text {Subst}\left (\int \frac {\sqrt {a+b x}}{1-x} \, dx,x,\tanh ^2(x)\right )\\ &=-\sqrt {a+b \tanh ^2(x)}+\frac {1}{2} (a+b) \text {Subst}\left (\int \frac {1}{(1-x) \sqrt {a+b x}} \, dx,x,\tanh ^2(x)\right )\\ &=-\sqrt {a+b \tanh ^2(x)}+\frac {(a+b) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}-\frac {x^2}{b}} \, dx,x,\sqrt {a+b \tanh ^2(x)}\right )}{b}\\ &=\sqrt {a+b} \tanh ^{-1}\left (\frac {\sqrt {a+b \tanh ^2(x)}}{\sqrt {a+b}}\right )-\sqrt {a+b \tanh ^2(x)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.02, size = 44, normalized size = 1.00 \begin {gather*} \sqrt {a+b} \tanh ^{-1}\left (\frac {\sqrt {a+b \tanh ^2(x)}}{\sqrt {a+b}}\right )-\sqrt {a+b \tanh ^2(x)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(237\) vs.
\(2(36)=72\).
time = 0.69, size = 238, normalized size = 5.41
method | result | size |
derivativedivides | \(-\frac {\sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}}{2}+\frac {\sqrt {b}\, \ln \left (\frac {b \left (1+\tanh \left (x \right )\right )-b}{\sqrt {b}}+\sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}\right )}{2}+\frac {\sqrt {a +b}\, \ln \left (\frac {2 a +2 b -2 b \left (1+\tanh \left (x \right )\right )+2 \sqrt {a +b}\, \sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}}{1+\tanh \left (x \right )}\right )}{2}-\frac {\sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}}{2}-\frac {\sqrt {b}\, \ln \left (\frac {b \left (\tanh \left (x \right )-1\right )+b}{\sqrt {b}}+\sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}\right )}{2}+\frac {\sqrt {a +b}\, \ln \left (\frac {2 a +2 b +2 b \left (\tanh \left (x \right )-1\right )+2 \sqrt {a +b}\, \sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}}{\tanh \left (x \right )-1}\right )}{2}\) | \(238\) |
default | \(-\frac {\sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}}{2}+\frac {\sqrt {b}\, \ln \left (\frac {b \left (1+\tanh \left (x \right )\right )-b}{\sqrt {b}}+\sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}\right )}{2}+\frac {\sqrt {a +b}\, \ln \left (\frac {2 a +2 b -2 b \left (1+\tanh \left (x \right )\right )+2 \sqrt {a +b}\, \sqrt {b \left (1+\tanh \left (x \right )\right )^{2}-2 b \left (1+\tanh \left (x \right )\right )+a +b}}{1+\tanh \left (x \right )}\right )}{2}-\frac {\sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}}{2}-\frac {\sqrt {b}\, \ln \left (\frac {b \left (\tanh \left (x \right )-1\right )+b}{\sqrt {b}}+\sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}\right )}{2}+\frac {\sqrt {a +b}\, \ln \left (\frac {2 a +2 b +2 b \left (\tanh \left (x \right )-1\right )+2 \sqrt {a +b}\, \sqrt {b \left (\tanh \left (x \right )-1\right )^{2}+2 b \left (\tanh \left (x \right )-1\right )+a +b}}{\tanh \left (x \right )-1}\right )}{2}\) | \(238\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 489 vs.
\(2 (36) = 72\).
time = 0.43, size = 1543, normalized size = 35.07 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 1.27, size = 51, normalized size = 1.16 \begin {gather*} - \frac {2 \left (\frac {b \sqrt {a + b \tanh ^{2}{\left (x \right )}}}{2} + \frac {b \left (a + b\right ) \operatorname {atan}{\left (\frac {\sqrt {a + b \tanh ^{2}{\left (x \right )}}}{\sqrt {- a - b}} \right )}}{2 \sqrt {- a - b}}\right )}{b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 349 vs.
\(2 (36) = 72\).
time = 0.61, size = 349, normalized size = 7.93 \begin {gather*} -\frac {1}{2} \, \sqrt {a + b} \log \left ({\left | -{\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )} {\left (a + b\right )} - \sqrt {a + b} {\left (a - b\right )} \right |}\right ) + \frac {1}{2} \, \sqrt {a + b} \log \left ({\left | -\sqrt {a + b} e^{\left (2 \, x\right )} + \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b} + \sqrt {a + b} \right |}\right ) - \frac {1}{2} \, \sqrt {a + b} \log \left ({\left | -\sqrt {a + b} e^{\left (2 \, x\right )} + \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b} - \sqrt {a + b} \right |}\right ) - \frac {4 \, {\left ({\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )} b - \sqrt {a + b} b\right )}}{{\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )}^{2} + 2 \, {\left (\sqrt {a + b} e^{\left (2 \, x\right )} - \sqrt {a e^{\left (4 \, x\right )} + b e^{\left (4 \, x\right )} + 2 \, a e^{\left (2 \, x\right )} - 2 \, b e^{\left (2 \, x\right )} + a + b}\right )} \sqrt {a + b} + a - 3 \, b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.69, size = 51, normalized size = 1.16 \begin {gather*} -\sqrt {b\,{\mathrm {tanh}\left (x\right )}^2+a}-2\,\mathrm {atan}\left (\frac {2\,\sqrt {b\,{\mathrm {tanh}\left (x\right )}^2+a}\,\sqrt {-\frac {a}{4}-\frac {b}{4}}}{a+b}\right )\,\sqrt {-\frac {a}{4}-\frac {b}{4}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________